package com.smh.a01DateDemo1;

import java.util.Date;
import java.util.Random;

public class DateDemo2 {
    public static void main(String[] args) {
        getDate();

        Random random = new Random();
        Date date = new Date(Math.abs(random.nextInt()));
        Date date2 = new Date(Math.abs(random.nextInt()));
        System.out.println(date);
        System.out.println(date2);
        System.out.println();
        if (date.getTime()>date2.getTime()){
            System.out.println(date);
        }else {
            System.out.println(date2);
        }

    }

    private static void getDate() {
        Date date = new Date(0L);
        long time = date.getTime();
        time= time+1000*60*60*24*365L;
        date.setTime(time);
        System.out.println(date);
    }
}
